Skip to content

Updated from new MyFormType() to MyFormType::class #9765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

ThomasLandauer
Copy link
Contributor

Passing a new instance of the form type gave me this error:

Type error: Argument 1 passed to Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener::__construct() must be of the type string, object given

Passing a new instance of the form type gave me this error:

> Type error: Argument 1 passed to Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener::__construct() must be of the type string, object given
@yceruto
Copy link
Member

yceruto commented May 14, 2018

Hi @ThomasLandauer, you're right about this, but in 2.7 it's still allowed. Instead it should be changed since 3.4 where passing a string is mandatory.

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix! As Yonel explained, we'll merge it on 3.4 branch.

@xabbuh xabbuh modified the milestones: 3.4, 2.8 May 14, 2018
xabbuh added a commit that referenced this pull request May 14, 2018
…homasLandauer)

This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #9765).

Discussion
----------

Updated from `new MyFormType()` to `MyFormType::class`

Passing a new instance of the form type gave me this error:

> Type error: Argument 1 passed to Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener::__construct() must be of the type string, object given

<!--

If your pull request fixes a BUG, use the oldest maintained branch that contains
the bug (see https://symfony.com/roadmap for the list of maintained branches).

If your pull request documents a NEW FEATURE, use the same Symfony branch where
the feature was introduced (and `master` for features of unreleased versions).

-->

Commits
-------

b031b97 Updated from `new MyFormType()` to `MyFormType::class`
@xabbuh
Copy link
Member

xabbuh commented May 14, 2018

In fact, the ability to pass forms by the FQCN instead of form type instances was introduced in 2.8 and is required since 3.0. I have merged your PR into the 2.8 branch. Thank you @ThomasLandauer.

@xabbuh xabbuh closed this May 14, 2018
@ThomasLandauer ThomasLandauer deleted the patch-12 branch May 14, 2018 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants